package com.gmaker.spring.study.cloud.eureka.service.consume.web;

import com.gmaker.spring.study.cloud.eureka.service.consume.service.ComputeClient;
import com.gmaker.spring.study.cloud.eureka.service.consume.service.ComputeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * consumer controller
 *
 * Created by wtg on 2016/10/25.
 */
@RestController
public class ConsumerController {

    @Autowired
    private ComputeService computeService;

    @Autowired
    private ComputeClient computeClient;

    @RequestMapping(value = "/addByRibbon", method = RequestMethod.GET)
    public String addByRibbon() {
        return computeService.addService();
    }

    @RequestMapping(value = "/addByFeign", method = RequestMethod.GET)
    public Integer addByFeign() {
        return computeClient.add(10, 20);
    }

}
